import type { BadgeThemeVarBaseConfig, BadgeThemeVarConfig } from './types'
import { ThemeElement, ThemeProperty } from '../../types'
import { BaseThemeVarService } from '../base'

export class BadgeThemeVarService extends BaseThemeVarService {
  private static instance: BadgeThemeVarService

  static getInstance(): BadgeThemeVarService {
    if (!BadgeThemeVarService.instance) {
      BadgeThemeVarService.instance = new BadgeThemeVarService()
    }
    return BadgeThemeVarService.instance
  }

  get default(): BadgeThemeVarConfig {
    return {
      green: this.green,
      red: this.red,
    }
  }

  get green(): BadgeThemeVarBaseConfig {
    return {
      text: this.varMapper.getVarName({
        element: ThemeElement.Badge,
        subElement: 'green',
        property: ThemeProperty.Text,
      }),
      background: this.varMapper.getVarName({
        element: ThemeElement.Badge,
        subElement: 'green',
        property: ThemeProperty.Bg,
      }),
      borderColor: this.varMapper.getVarName({
        element: ThemeElement.Badge,
        subElement: 'green',
        property: ThemeProperty.Border,
      }),
    }
  }

  get red(): BadgeThemeVarBaseConfig {
    return {
      text: this.varMapper.getVarName({
        element: ThemeElement.Badge,
        subElement: 'red',
        property: ThemeProperty.Text,
      }),
      background: this.varMapper.getVarName({
        element: ThemeElement.Badge,
        subElement: 'red',
        property: ThemeProperty.Bg,
      }),
      borderColor: this.varMapper.getVarName({
        element: ThemeElement.Badge,
        subElement: 'red',
        property: ThemeProperty.Border,
      }),
    }
  }
}
